package com.common.help.test18;
import java.util.Arrays;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;

public class Test19 {

	public static void main(String[] args){
		/************测试数据****************/
		//原有数组
		long[] arr = {10,33,101,136,144,199,200,400};
		//开始时间190，结束300
		long start = 190l;
		long[] newarr = new long[arr.length + 1];
		/****************************************/
		//复制初始数组
		for(int i = 0; i < arr.length; i++){
			newarr[i] = arr[i];
		}
		newarr[arr.length] = start;
		
		//排序
		Arrays.sort(newarr);
		
		//取出开始时间和结束时间所在的位置
		int indexstart = Arrays.binarySearch(newarr, start);
		System.out.println("start index " + indexstart);
		if((indexstart % 2) == 0){
			System.out.println("开始时间位于收费时段");
		}else{
			System.out.println("开始时间位于免费时段");
		}
		
		
		String orderId = "OrderPR201899999";
		System.out.println(orderId.substring(5, orderId.length()));
		
		
		MyFile f = new MyFile();
		
		String ss = JSON.toJSONString(f);
		System.out.println(ss);
		JSONObject obj = JSON.parseObject(ss);
		
		if(obj!=null){
			int aa =obj.getIntValue("siz");
			System.out.println(aa);
		}
}
	
}
